<%@ Page Language="C#" debug="true" %>
<%@ Register Namespace=MyControls.DataSources.ObjectHierarchicalDataSource TagPrefix=my %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ObjectHierarchicalDataSource</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <my:ObjectHierarchicalDataSource runat=server ID=ObjectInstance1 TypeName="Categories">
        <SelectMethods>
            <my:SelectMethod TypeName="CatsCategory" Method="GetCats" />
            <my:SelectMethod TypeName="Cat" PropertyNames="Color,Gender" />
        </SelectMethods>
    </my:ObjectHierarchicalDataSource>
    
    <asp:TreeView Runat=Server ID=categoryTree DataSourceID=ObjectInstance1 ExpandDepth=0 PopulateNodesFromClient=true>
        <DataBindings>
            <asp:TreeNodeBinding TextField="#" ValueField="#" ToolTipField="#" PopulateOnDemand=true />
            <asp:TreeNodeBinding DataMember="CatsCategory" TextField="Name" ValueField="Name" ToolTipField="Name" PopulateOnDemand=true />
            <asp:TreeNodeBinding DataMember="Cat" TextField="Name" ValueField="Name" ToolTipField="Description" PopulateOnDemand=true />
            <asp:TreeNodeBinding DataMember="Color" FormatString="Color: {0}" PopulateOnDemand="true"
                SelectAction="None" TextField="Name" ValueField="Name" ToolTipField="#" />
            <asp:TreeNodeBinding DataMember="Gender" PopulateOnDemand="true" SelectAction="None"
                TextField="#" ValueField="#" ToolTipField="#" />
        </DataBindings>
    </asp:TreeView>
    <%= Request.ServerVariables["HTTP_USER_AGENT"] %>
    <input type=button onclick="alert(window.navigator.userAgent)" value="Click me"/>
    </div>
    </form>
</body>
</html>